﻿using System;
using System.Collections.Generic;
using System.Text;
using TarreOA.TarreOAModels;
using TarreOA.TarreOADAL;

namespace TarreOA.TarreOABLL
{
    public class TalkHouseListService
    {
        /// <summary>
        /// 新建聊天室信息
        /// </summary>
        /// <param name="thName"></param>
        /// <param name="thLutime"></param>
        /// <returns></returns>
        public int SaveTalkHouseInfo(string thName, string thWelcome, string thTheme, DateTime thLutime)
        {
            TalkHouseListDAO thlDAO = new TalkHouseListDAO();
            return thlDAO.SaveTalkHouseInfo(thName,thWelcome, thTheme, thLutime);
        }

          /// <summary>
        /// 查找聊天室信息列表
        /// </summary>
        /// <returns></returns>
        public List<TalkHouseList> findALL()
        {
            TalkHouseListDAO thlDAO = new TalkHouseListDAO();
            return thlDAO.findALL();
        }

        /// <summary>
        /// 根据编号查询聊天室信息
        /// </summary>
        /// <param name="thid"></param>
        /// <returns></returns>
        public TalkHouseList findById(int thid)
        {
            TalkHouseListDAO thlDAO = new TalkHouseListDAO();
            return thlDAO.findById(thid);
        }

        /// <summary>
        /// 根据聊天室编号更新聊天室信息
        /// </summary>
        /// <param name="thName"></param>
        /// <param name="thLutime"></param>
        /// <param name="thid"></param>
        /// <returns></returns>
        public int UpdateTalkHouseInfo(string thName, string thWelcome, string thTheme, DateTime thLutime, int thid)
        {
            TalkHouseListDAO thlDAO = new TalkHouseListDAO();
            return thlDAO.UpdateTalkHouseInfo(thName, thWelcome, thTheme, thLutime, thid);
        }

         /// <summary>
        /// 根据聊天室编号删除聊天室信息
        /// </summary>
        /// <param name="thid"></param>
        /// <returns></returns>
        public int DelTalkHouseInfoById(int thid)
        {
            TalkHouseListDAO thlDAO = new TalkHouseListDAO();
            return thlDAO.DelTalkHouseInfoById(thid);
        }

        /// <summary>
        /// 根据聊天室编号更改聊天室开放状态
        /// </summary>
        /// <param name="state"></param>
        /// <param name="thlid"></param>
        /// <returns></returns>
        public int UpdateTalkHouseOpenState(int state, int thlid)
        {
            TalkHouseListDAO thlDAO = new TalkHouseListDAO();
            return thlDAO.UpdateTalkHouseOpenState(state, thlid);
        }
    }
}
